﻿using System;
using System.Net;

namespace Cn.Soncy.Taotao
{
    /*
     * --------------------------------
     * FileName: TaotaoRequest.cs
     * Description: 滔滔请求类,用于建立与滔滔API服务器连接
     * 
     * Author: Soncy
     * DateTime: 2008-11-27
     * E-mail: soncy@163.com
     * --------------------------------
     */

    /// <summary>
    /// 滔滔请求类,用于建立与滔滔API服务器连接
    /// </summary>
    /// <example>
    /// TaotaoRequest request = new TaotaoRequest("17008888",10,0);
    /// TaotaoResponse response = request.GetResponse();
    /// TaotaoUser = response.ui; //获取用户信息
    /// List<TaotaoPost> Posts = response.posts; //获取滔滔列表
    /// int total = response.total; //获取滔滔的总数
    /// string imgHead = response.headImage; //获取滔滔的头像
    /// </example>
    public class TaotaoRequest
    {
        /// <summary>
        /// Taotao Request 对象
        /// </summary>
        /// <param name="qq">QQ号码</param>
        /// <param name="num">返回滔滔数量</param>
        /// <param name="t">返回滔滔类型,0-QQ号码所发布滔滔,1-QQ号码以及好友所发布的滔滔</param>
        public TaotaoRequest(string qq, int num, int t)
        {
            this.QQ = qq;
            this.Num = num;
            this.T = t;
        }

        /// <summary>
        /// Taotao Request 对象(默认为返回QQ号码10条滔滔)
        /// </summary>
        /// <param name="qq"></param>
        public TaotaoRequest(string qq)
        {
            this.QQ = qq;
            this.Num = 10;
            this.T = 0;
        }

        /// <summary>
        /// 查看的QQ号码
        /// </summary>
        public string QQ { get; set; }

        /// <summary>
        /// 返回数据数量, 1-20, 默认为10
        /// </summary>
        public int Num { get; set; }

        /// <summary>
        /// 返回类型, 0-被查看QQ滔滔, 1-被查看QQ和好友滔滔
        /// </summary>
        public int T { get; set; }

        /// <summary>
        /// 返回 Taotao 数据
        /// </summary>
        /// <returns></returns>
        public TaotaoResponse GetResponse()
        {
            TaotaoResponse response = new TaotaoResponse();
            response = response.Get(this.QQ, this.Num, this.T);

            return response;
        }
    }
}
